import { message } from 'antd';
import { useEffect, useState } from 'react';

import { getAllDocx } from '@/services/orderManage';
import { getQueryVariable } from '@/util/utils';

import AllAgreeMent from './AllAgreeMent';

const Agreement = () => {
  const [path, setPath] = useState<string>('');
  const getPath = async () => {
    if (getQueryVariable('id')) {
      const res = await getAllDocx(Number(getQueryVariable('id')));
      if (res.code === 200) {
        setPath(`${res.data.path}`);
      } else {
        message.error('获取失败');
      }
    }
  };
  useEffect(() => {
    getPath();
  }, []);
  return (
    <>
      {
        path!==''&&
        <AllAgreeMent path={path}/>
      }
    </>
  );
};
export default Agreement;
